package com.ck.design.monitor;

/**
 * @author timiv
 */
public class Person {

    private String name;

    private PersonListener personListener;

    public void registerListener(PersonListener personListener){
        this.personListener = personListener;
    }

    public Person(String name){
        this.name = name;
    }

    public void eat(){
        personListener.eat(new Event(this));
    }

    public void sleep(){
        personListener.sleep(new Event(this));
    }

    public String getName() {
        return name;
    }
}
